<?php
namespace Admin\Model;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;

class Video implements InputFilterAwareInterface
{
	public $video_id;
	public $title;
    public $url;
    public $image;
    public $status;
    public $categories_id;
	protected $inputFilter; 
                // <-- Add this variable
    public function exchangeArray($data)
    {

        $this->video_id  = (isset($data['video_id']))     ? $data['video_id'] : null;
        $this->title = (isset($data['title'])) ? $data['title'] : null;
        $this->url = (isset($data['url'])) ? $data['url'] : null;
        $this->image = (isset($data['image'])) ? $data['image'] : null;
        $this->status = (isset($data['status'])) ? $data['status'] : null;
        $this->categories_id = (isset($data['categories_id'])) ? $data['categories_id'] : null;      
    }
    public function setInputFilter(InputFilterInterface $inputFilter)
    {
        throw new \Exception("Not used");
    }
    public function getInputFilter()
    {
        if (!$this->inputFilter) {
            $inputFilter = new InputFilter();
            $factory     = new InputFactory();

            $inputFilter->add($factory->createInput(array(
                'name'     => 'video_id',
                'required' => true,
                'filters'  => array(
                    array('name' => 'Int'),
                ),
            )));

            $inputFilter->add($factory->createInput(array(
                'name'     => 'title',
                'required' => true,
                'filters'  => array(
                    array('name' => 'StripTags'),
                    array('name' => 'StringTrim'),
                ),
                'validators' => array(
                    array(
                        'name'    => 'StringLength',
                        'options' => array(
                            'encoding' => 'UTF-8',
                            'min'      => 1,
                            'max'      => 100,
                        ),
                    ),
                ),
            )));


             $inputFilter->add($factory->createInput(array(
                'name'     => 'url',
                'required' => true,
                'filters'  => array(
                    array('name' => 'StripTags'),
                    array('name' => 'StringTrim'),
                ),
                'validators' => array(
                    array(
                        'name'    => 'StringLength',
                        'options' => array(
                            'encoding' => 'UTF-8',
                            'min'      => 1,
                            'max'      => 100,
                        ),
                    ),
                ),
            )));


            $inputFilter->add($factory->createInput(array(
                'name'     => 'image',
                'required' => true,
                'filters'  => array(
                    array('name' => 'StripTags'),
                    array('name' => 'StringTrim'),
                ),
                'validators' => array(
                    array(
                        'name'    => 'StringLength',
                        'options' => array(
                            'encoding' => 'UTF-8',
                            'min'      => 1,
                            'max'      => 100,
                        ),
                    ),
                ),
            )));




            $inputFilter->add($factory->createInput(array(
                'name'     => 'status',
                'required' => true,
                'filters'  => array(
                    array('name' => 'Int'),
                ),
            )));


            $inputFilter->add($factory->createInput(array(
                'name'     => 'categories_id',
                'required' => true,
                'filters'  => array(
                    array('name' => 'Int'),
                ),
            )));
           
            $this->inputFilter = $inputFilter;
        }

        return $this->inputFilter;
    }
}